<%@page import="java.util.Date"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>公司列表</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		
	});
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</script>
</head>
<body>
	<%-- <ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/common/supplierManageList/">供应商列表</a></li>
	</ul> --%>
	<form:form id="searchForm" modelAttribute="office" action="${ctx}/sys/office/dialogCompanyList" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input id="type" name="type" type="hidden" value="${param.type}"/>
		<input id="ids" name="ids" type="hidden" value="${param.ids}"/>
		<c:if test="${param.showMyOffice != null}">
		<input id="showMyOffice" name="showMyOffice" type="hidden" value="${param.showMyOffice}"/>
		</c:if>
	    <sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<table class="t-search">
			<tr>
				<td>公司编号：</td>
				<td>
					<form:input path="code" htmlEscape="false" maxlength="225" class="input-search"/>
				</td>
				<td>公司名称：</td>
				<td>
					<form:input path="name" htmlEscape="false" maxlength="225" class="input-search"/>
				</td>
				<td style="width:0px;">
				</td>			
				<td class="tb-btn">
					<input id="btn_search" class="btn btn-primary" type="submit" value="查询"/>
					<input type="button" id="reset_" class="reset btn" value="重置"/>
				</td>
			</tr>
		</table>
	</form:form>
	<!-- <sys:message content="消息" /> -->
	<div class="css-dialog-tl">
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed jqgrid-select">
		<thead>
			<tr>
				<th style="width:20px;" ><input class="checkall" type="checkbox"/></th>
				<th style="width:300px;" class="sort-column name">公司名称</th>
				<th style="width:80px;" class="sort-column code">公司编号</th>
				<!-- <th style="width:60px;">组织类型</th> -->
			</tr>
		</thead>
		<tbody>
			<c:if test="${empty page.list}">
				<tr>
					<td class="center" colspan=3>没有数据</td>
				</tr>
			</c:if>
			<c:forEach items="${page.list}" var="office">
				<tr>
					<td>
						<input type="checkbox"/>
						<input type="hidden" id="id" name="id" value="${office.id}"/>
						<input type="hidden" id="name" name="name" value="${office.name }"/>
					</td>
					<td>${office.name }</td>
					<td class="center">${office.code }</td>
					<%-- <td class="center">${office.typeName }</td> --%>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<script>
		var selects=false; //false 单选   true 可以多选
		
		if(selects){
			$(".checkall").removeAttr("disabled");
		}else{
			$(".checkall").attr("disabled","disabled");
		}
		
		$(".jqgrid-select tr").click(function(){
			if(selects){
				if($(this).hasClass("jdselect")){
					$(this).removeClass("jdselect");
					$(this).find("td:first input[type=checkbox]").removeAttr("checked");
				}else{
					$(this).addClass("jdselect");
					$(this).find("td:first input[type=checkbox]").attr("checked","true");
				}
			}else{
				$(this).addClass("jdselect");
				$(this).find("td:first input[type=checkbox]").attr("checked","true");
				$(this).siblings().removeClass("jdselect");
				$(this).siblings().find("td:first input[type=checkbox]").removeAttr("checked");
			}
		});
		
		$(".checkall").click(function(){
			if($(this).is(":checked")){
				$(this).parents("table").find("tr:gt(0)").addClass("jdselect");
				$(this).parents("table").find("tr:gt(0)").find("td:first input[type=checkbox]").attr("checked","true");
			}else{
				$(this).parents("table").find("tr:gt(0)").removeClass("jdselect");
				$(this).parents("table").find("tr:gt(0)").find("td:first input[type=checkbox]").removeAttr("checked");
			}
		});
		
	</script>
	</div>
	<div class="pagination">${page}</div>
</body>
</html>